/**
 * Created by Jie on 2017/2/10.
 */
import React, {Component} from 'react';
import {
    AppRegistry,
    TouchableHighlight,
    TouchableNativeFeedback,
    ListView,
    InteractionManager,
    Image,
    View,
    StyleSheet,
    Text,
    ToastAndroid,
    TouchableWithoutFeedback,
    ToolbarAndroid,
    ActivityIndicator
} from 'react-native';
export default class ListViewFooter extends Component {

    static defaultProps = {
        footState: 0 //0:正在加载 1:已加载全部 2:加载失败
    };

    static propTypes = {
        footState: React.PropTypes.number
    };

    render() {
        return(
            <View style={styles.listViewFooterContainer}>
                {this._renderType()}
                <Text style={{color: '#767675', fontSize: 16}}>{footerText[this.props.footState]}</Text>
            </View>
        );
    }

    _renderType() {
        if (this.props.footState === 0) {
            return (
                <ActivityIndicator style={{width: 20, height: 20}}/>
            );
        }
    }
}

const footerText = ['正在加载...', '已加载全部', '加载失败'];

const styles = StyleSheet.create({
    listViewFooterContainer: {
        height: 40,
        flexDirection: 'row',
        justifyContent: 'center',
        alignItems: 'center'
    },
});
